<?php
/* first visible interface */
include('config/config.php');
include('config/funcs.php');

echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01\//EN" "http://www.w3.org/TR/html4/strict.dtd">';
echo '<html>';
echo '	<head>';
echo '		<meta http-equiv="Content-Type" content="text\/html; charset=iso-8859-1" />';
echo '		<title>KooDB MySQL Interface</title>';
echo '		<link rel="stylesheet" type="text/css" href="config/koodb.css">';
echo '	</head>';
echo '<body>';

echo '<h4>Databases</h4>';

echo showDbs();

echo '<h4>Add A New Database</h4>';
echo '<form action="adddb.php" method="post">';
echo '	What is the name of the new database?';
echo '	<input type="text" name="dbName"><br />';
echo '	<input type="submit" name="submit" value="submit"> <input type="reset">';
echo '</form>';
echo '<br><hr><br>';
echo '<h4>Users</h4>';

echo listDbUsers();

echo '<br />';
echo '<form action="adduser.php" method="post">';
echo '	Add a user';
echo '	<input type="text" name="userName"><br />';
echo '	Password';
echo '	<input type="password" name="userPass"><br />';
echo '	Confirm password';
echo '	<input type="password" name="confirmPass"><br />';
echo '	<input type="submit" name="submit" value="submit"> <input type="reset">';
echo '</form>';
echo '<br><hr><br>		';

echo '<h4>Add A User to a Database</h4>';
echo '<form name="AddUser2DBForm" method="post" action="addusertodb.php">';
echo '	Add User <br>';
echo '	<select name="defineUser" id="defineUser">';

echo getDbUsers();

echo '	</select>';
echo '	<br><br>';
echo '	To Database';
echo '	<br>';
echo '	<select name="defineDb" id="defineDb">';

echo getDbs();

echo '	</select>';
echo '	<br>';
echo '	<br>';
echo '	With Permissions<br />';
echo '	<br /><input name="dbPerms" value="ALL" type="checkbox">All<br />';
echo '	<input name="dbPerms" value="Alter" type="checkbox">Alter<br />';
echo '	<input name="dbPerms" value="Alter Routine" type="checkbox">Alter Routine<br />';
echo '	<input name="dbPerms" value="Create" type="checkbox">Create<br />';
echo '	<input name="dbPerms" value="Create Routine" type="checkbox">Create Routine<br />';
echo '	<input name="dbPerms" value="Create Temporary Tables" type="checkbox">Create Temporary Tables<br />';
echo '	<input name="dbPerms" value="Create User" type="checkbox">Create User<br />';
echo '	<input name="dbPerms" value="Create View" type="checkbox">Create View<br />';
echo '	<input name="dbPerms" value="Delete" type="checkbox">Delete<br />';
echo '	<input name="dbPerms" value="Drop" type="checkbox">Drop<br />';
echo '	<input name="dbPerms" value="Execute" type="checkbox">Execute<br />';
echo '	<input name="dbPerms" value="File" type="checkbox">File<br />';
echo '	<input name="dbPerms" value="Index" type="checkbox">Index<br />';
echo '	<input name="dbPerms" value="Insert" type="checkbox">Insert<br />';
echo '	<input name="dbPerms" value="Lock Tables" type="checkbox">Lock Tables<br />';
echo '	<input name="dbPerms" value="Process" type="checkbox">Process<br />';
echo '	<input name="dbPerms" value="References" type="checkbox">References<br />';
echo '	<input name="dbPerms" value="Reload" type="checkbox">Reload<br />';
echo '	<input name="dbPerms" value="Replication Client" type="checkbox">Replication Client<br />';
echo '	<input name="dbPerms" value="Replication Slave" type="checkbox">Replication Slave<br />';
echo '	<input name="dbPerms" value="Select" type="checkbox">Select<br />';
echo '	<input name="dbPerms" value="Show Databases" type="checkbox">Show Databases<br />';
echo '	<input name="dbPerms" value="Show View" type="checkbox">Show View<br />';
echo '	<input name="dbPerms" value="Shutdown" type="checkbox">Shutdown<br />';
echo '	<input name="dbPerms" value="Super" type="checkbox">Super<br />';
echo '	<input name="dbPerms" value="Update" type="checkbox">Update<br />';
echo '	<input name="dbPerms" value="Usage" type="checkbox">Usage<br />';
echo '	<input name="dbPerms" value="Grant Option" type="checkbox">Grant Option<br /><input name="submit" value="Submit" type="submit">';
echo '</form>';
echo '<br><hr><br>';
echo '</body></html>';
?>

